import config from './config'
// 将我们的请求变成一个函数，使用promise进行二次封装方便使用
export default function ({url,methods="get",data=""}){
 return new Promise((resolve,reject)=>{
  wx.request({
    url: config.baseUrl + url, 
    data,
    methods,
    header: {
      cookie:'MUSIC_U=0ab8b2f121f91c9f05ab2c68c658d5cb6c87265fc8b8592633860747b903050e519e07624a9f0053579dedcab98466d2a7ce7ebc6175c5a36dbaec12eb14a297fb1d45a3ed8f2b6ad4dbf082a8813684; Max-Age=1296000; Expires=Thu, 13 Apr 2023 02:29:08 GMT; Path=/; Domain=.music.163.com; HTTPOnly'
    },
    success (res) {
      // console.log(res);
      resolve(res.data)
    },
    fail(error){
      reject(error)
    }
  })
 })
}